library(tmap)
dresden <-
osmdata::getbb("Dresden") %>%
osmdata::opq(timeout = 25*100) %>%
osmdata::add_osm_feature(
key = "building",
value = c("house", "residential")
) %>%
osmdata::osmdata_sf() %>%
.$osm_polygons %>%
tibble::as_tibble() %>%
sf::st_as_sf()
dresden
## Simple feature collection with 14557 features and 122 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 13.57913 ymin: 50.97482 xmax: 13.96545 ymax: 51.17778
## Geodetic CRS: WGS 84
## # A tibble: 14,557 × 123
## osm_id name X3dr.type abandoned abandoned.man_m… access addr.city addr.country addr.housename addr.housenumber
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 22986… <NA> <NA> <NA> <NA> <NA> Dresden <NA> <NA> 11
## 2 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 16
## 3 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 10
## 4 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 12
## 5 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 14
## 6 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 62
## 7 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 9
## 8 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 11a
## 9 22986… <NA> <NA> <NA> <NA> <NA> Dresden DE <NA> 11b
## 10 22986… <NA> <NA> <NA> <NA> <NA> Dresden <NA> <NA> 4
## # … with 14,547 more rows, and 113 more variables: addr.postcode <chr>, addr.street <chr>, addr.suburb <chr>,
## # addr.suburb.en <chr>, alt_name <chr>, amenity <chr>, architect <chr>, area <chr>, attraction <chr>,
## # brand <chr>, brand.wikidata <chr>, building <chr>, building.architecture <chr>, building.colour <chr>,
## # building.levelPlan <chr>, building.levels <chr>, building.levels.underground <chr>, building.material <chr>,
## # building.part <chr>, building.roof <chr>, building.roof.colour <chr>, building.roof.shape <chr>,
## # building.use <chr>, castle_type <chr>, check_date <chr>, cn_tud.token <chr>, colour <chr>, comment <chr>,
## # community_centre <chr>, community_centre.for <chr>, construction <chr>, construction.building <chr>, …
tm_shape(dresden) +
tm_polygons()